import time

import allure
from selenium.webdriver.common.by import By
from .base import Base


class Delete(Base):
    # 删除按钮      删除弹窗内容
    __DELETE_BUTTON = (By.CSS_SELECTOR, "tbody > tr:nth-child(1) > td:last-child button:nth-child(2)")
    __DELETE_POP_UP_TEXT = (By.CSS_SELECTOR, "div.el-notification.right div.el-notification__content > p")

    def delete(self):
        with allure.step("删除商品"):
            self.find_click(self.__DELETE_BUTTON)
            text = self.find_text(self.__DELETE_POP_UP_TEXT)
            self.images_log("delete_prompt_message", "删除提示信息")
        return text
